{/* Copyright 2025 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License. */}

import {Layout} from '../../src/Layout';
export default Layout;
import {GroupedPropTable} from '../../src/PropTable';
import {FunctionAPI} from '../../src/FunctionAPI';
import docs from 'docs:@react-aria/focus';

export const section = 'Interactions';
export const description = 'A utility component that applies a visual focus indicator to its child element when focused via keyboard.';

# FocusRing

<PageDescription>{docs.exports.FocusRing.description}</PageDescription>

```tsx render files={["packages/dev/s2-docs/pages/react-aria/FocusRingExample.css"]}
'use client';
import {FocusRing} from '@react-aria/focus';
import './FocusRingExample.css';

<FocusRing focusRingClass="focus-ring">
  <button className="button">Test</button>
</FocusRing>
```

## Features

`FocusRing` is a utility component that can be used to apply a CSS class when an element has keyboard focus.
This helps keyboard users determine which element on a page or in an application has keyboard focus as they
navigate around. Focus rings are only visible when interacting with a keyboard so as not to distract mouse
and touch screen users. When we are unable to detect if the user is using a mouse or touch screen, such as
switching in from a different tab, we show the focus ring.

If CSS classes are not being used for styling, see [useFocusRing](useFocusRing) for a hooks version.

## API

### FocusRing

<PropTable links={docs.links} component={docs.exports.FocusRing} />
